import json
import sys
import os


def ocr(path):
    import easyocr
    reader = easyocr.Reader(['ch_sim', 'en'])  # 创建reader对象
    result = reader.readtext(path, detail=0)  # detail = 0
    os.system('cls')
    print(result)
    with open(path+".txt", "w+") as f:
        json.dump(result, f)
    # print(json.dumps(result))
    # return result


ocr(json.loads(sys.stdin.read()))
